package test.nexthighertemperature;

public class Solution {
    public int[] dailyTemperatures(int[] T) {

        int[] result = new int[T.length];
        for (int i = 0; i < T.length; i++) {
            int j;
            for (j = i + 1; j < T.length; j++) {
                if (T[i] < T[j]) {
                    break;
                }
            }
            if (j == T.length) {
                result[i] = 0;
            } else {
                result[i] = j - i;
            }
        }
        return result;
    }
}
